package com.kaifamiao.demo.d0720;

public class Demo03 {

    public static void main(String[] args) {
        int[] arr = new int[100000000];

        for (int i = 0; i < arr.length; i ++){
            arr[i] = i;
        }

        // 分治
        long start = System.nanoTime(); // 纳秒值
        int num = 99999999;
        int index = -1; // 没找到 -1

        for(int i = arr.length - 1; i >= 0 ; i ++){
            if (arr[i] == num){
                index = i;
                break;
            }
        }

        if (index == -1){
            System.out.println("没找到");
        } else{
            System.out.println(num + " 在数组的下标是: " + index);
        }

        long end = System.nanoTime();

        System.out.println("共耗时：" + (end - start)); // 30669800

    }
}
